Skip to contentSkip to conversation

glamor: Initial commit to introduce glamor acceleration.

PATCH Superseded Zhigang Gong 3 participants 16 messages Nov 11, 2011 – Nov 14, 2011

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 glamor: Initial commit to introduce glamor acceleration.

Added one configuration option --enable-glamor to control whether use glamor. Added one new file intel_glamor.c to wrap glamor egl API for intel driver's usage.
This commit doesn't really change the driver's control path. It just adds necessary files for glamor and change some configuration.

---
 configure.ac       |   17 +++++++
 src/Makefile.am    |    5 ++
 src/intel_glamor.c |  130 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/intel_glamor.h |   45 ++++++++++++++++++
 4 files changed, 197 insertions(+), 0 deletions(-)
 create mode 100644 src/intel_glamor.c
 create mode 100644 src/intel_glamor.h
configure.ac +17 -0
index fccab56..dc01c46 100644
@@ -126,6 +126,15 @@ AC_ARG_ENABLE(sna,
 	      [SNA="$enableval"],
 	      [SNA=no])
 AM_CONDITIONAL(SNA, test x$SNA != xno)
+
+AC_ARG_ENABLE(glamor,
+	      AS_HELP_STRING([--enable-glamor],
+			     [Enable glamor, a new GL-based acceleration [default=no]]),
+	      [GLAMOR="$enableval"],
+	      [GLAMOR=no])
+
+AM_CONDITIONAL(GLAMOR, test x$GLAMOR != xno)
+
 AC_MSG_CHECKING([whether to include SNA support])
 
 required_xorg_xserver_version=1.6
@@ -137,6 +146,14 @@ if test "x$SNA" != "xno"; then
 fi
 AC_MSG_RESULT([$SNA])
 
+if test "x$GLAMOR" != "xno"; then
+	PKG_CHECK_MODULES(LIBGLAMOR, [glamor])
+	PKG_CHECK_MODULES(LIBGLAMOR_EGL, [glamor-egl])
+	AC_DEFINE(GLAMOR, 1, [Enable glamor acceleration])
+fi
+
+AC_MSG_CHECKING([whether to include GLAMOR support])
+AC_MSG_RESULT([$GLAMOR])
 
 AC_ARG_ENABLE(vmap,
 	      AS_HELP_STRING([--enable-vmap],
src/Makefile.am +5 -0
index cd1bb36..1a29390 100644
@@ -40,6 +40,10 @@ SUBDIRS += sna
 intel_drv_la_LIBADD += sna/libsna.la
 endif
 
+if GLAMOR
+GLAMOR_SOURCE = intel_glamor.c
+endif
+
 NULL:=#
 
 intel_drv_la_SOURCES = \
@@ -70,6 +74,7 @@ intel_drv_la_SOURCES = \
 	 i965_3d.c \
 	 i965_video.c \
 	 i965_render.c \
+	 $(GLAMOR_SOURCE) \
 	 $(NULL)
 
 if DRI
src/intel_glamor.c new file +130 -0

130 lines not on this page · raw message

src/intel_glamor.h new file +45 -0

45 lines not on this page · raw message

Signature · 6 lines
1.7.4.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/3 glamor: turn on glamor.

Add glamor's initialization to the uxa's control path. At preInit stage, it creates and initialize EGL display context for glamor. At the screenInit stage, it initialize glamor's internal data structures and shaders.

And this commit enables textured pixmap also. Each pixmap which has a valid BO can get a cooresponding texture.

After this commit. It's ready to do rendering through glamor's rendering functions.

---
 src/intel_driver.c |   25 ++++++++++++++++++++++++-
 src/intel_uxa.c    |   22 +++++++++++++++++++++-
 2 files changed, 45 insertions(+), 2 deletions(-)
src/intel_driver.c +24 -1
index 24696da..cf50d67 100644
@@ -75,6 +75,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "i915_drm.h"
 #include <xf86drmMode.h>
 
+#ifdef GLAMOR
+#include "intel_glamor.h"
+#endif
+
 /* *INDENT-OFF* */
 /*
  * Note: "ColorKey" is provided for compatibility with the i810 driver.
@@ -712,6 +716,20 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
 		return FALSE;
 	}
 
+#ifdef GLAMOR
+        /* Load glamor module */
+        if (!xf86LoadSubModule(scrn, "glamor_egl")) {
+                PreInitCleanup(scrn);
+                return FALSE;
+        }
+
+        if (!intel_glamor_pre_init(scrn)) {
+               xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+                          "Failed to pre init glamor display.\n");
+               return FALSE;
+        }
+#endif
+
 	/* Load the dri2 module if requested. */
 	if (intel->directRenderingType != DRI_DISABLED)
 		xf86LoadSubModule(scrn, "dri2");
@@ -1109,7 +1127,8 @@ static void I830FreeScreen(int scrnIndex, int flags)
 {
 	ScrnInfoPtr scrn = xf86Screens[scrnIndex];
 	intel_screen_private *intel = intel_get_screen_private(scrn);
-
+#ifdef GLAMOR
+#endif
 	if (intel) {
 		intel_mode_fini(intel);
 		intel_close_drm_master(intel);
@@ -1189,6 +1208,10 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen)
 
 	DeleteCallback(&FlushCallback, intel_flush_callback, scrn);
 
+#ifdef GLAMOR
+	intel_glamor_close_screen(screen);
+#endif
+
 	if (intel->uxa_driver) {
 		uxa_driver_fini(screen);
 		free(intel->uxa_driver);
src/intel_uxa.c +21 -1
index 8c6f754..f0e5803 100644
@@ -40,6 +40,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <string.h>
 #include <errno.h>
 
+#ifdef GLAMOR
+#include "intel_glamor.h"
+#endif
+
 static const int I830CopyROP[16] = {
 	ROP_0,			/* GXclear */
 	ROP_DSa,		/* GXand */
@@ -965,6 +969,9 @@ void intel_uxa_block_handler(intel_screen_private *intel)
 	 * framebuffer until significantly later.
 	 */
 	intel_flush_rendering(intel);
+#ifdef GLAMOR
+	intel_glamor_block_handler(intel);
+#endif
 }
 
 static PixmapPtr
@@ -1095,6 +1102,10 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 		list_init(&priv->batch);
 		list_init(&priv->flush);
 		intel_set_pixmap_private(pixmap, priv);
+#ifdef GLAMOR
+		priv->pinned = 1;
+                intel_glamor_create_textured_pixmap(pixmap);
+#endif
 	}
 
 	return pixmap;
@@ -1102,8 +1113,12 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 
 static Bool intel_uxa_destroy_pixmap(PixmapPtr pixmap)
 {
-	if (pixmap->refcnt == 1)
+	if (pixmap->refcnt == 1) {
+#ifdef GLAMOR
+		intel_glamor_destroy_pixmap(pixmap);
+#endif
 		intel_set_pixmap_bo(pixmap, NULL);
+	}
 	fbDestroyPixmap(pixmap);
 	return TRUE;
 }
@@ -1134,6 +1149,9 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen)
 		scrn->displayWidth = intel->front_pitch / intel->cpp;
 	}
 
+	if (!intel_glamor_create_screen_resources(screen))
+		return FALSE;
+
 	return TRUE;
 }
 
@@ -1296,5 +1314,7 @@ Bool intel_uxa_init(ScreenPtr screen)
 	uxa_set_fallback_debug(screen, intel->fallback_debug);
 	uxa_set_force_fallback(screen, intel->force_fallback);
 
+	intel_glamor_init(screen);
+
 	return TRUE;
 }
Signature · 1 line
1.7.4.4
#2 lore raw

Re: [PATCH 2/3] glamor: turn on glamor.

src/intel_uxa.c void intel_uxa_block_handler(intel_screen_private *intel) · line 975

Quoted 8 lines · Zhigang Gong
src/intel_uxa.c +3 -0
@@ -965,6 +969,9 @@ void intel_uxa_block_handler(intel_screen_private *intel)
 	 * framebuffer until significantly later.
 	 */
 	intel_flush_rendering(intel);
+#ifdef GLAMOR
+	intel_glamor_block_handler(intel);
+#endif
 }

I suspect this is the wrong way around as we are not flushing the render cache of glamor's rendering to the scanout until the next block handler.

In general, try to keep the #ifdef out of the body of the code. In this case, and others, make intel_glamor_block_handler() be a no-op if GLAMOR is not enabled.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#3 lore raw

Re: [PATCH 2/3] glamor: turn on glamor.

Quoted 12 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 5:12 PM
To: Zhigang Gong; [email protected]
Subject: Re: [Intel-gfx] [PATCH 2/3] glamor: turn on glamor.

Review void

Quoted 1 line · Zhigang Gong
(quoted diff) +0 -0
@@ -965,6 +969,9 @@ void

intel_uxa_block_handler(intel_screen_private *intel)

Quoted 10 lines

src/intel_uxa.c void intel_uxa_block_handler(intel_screen_private *intel) · line 975

Quoted 7 lines
src/intel_uxa.c +3 -0
 	 * framebuffer until significantly later.
 	 */
 	intel_flush_rendering(intel);
+#ifdef GLAMOR
+	intel_glamor_block_handler(intel);
+#endif
 }

I suspect this is the wrong way around as we are not flushing the render cache of glamor's rendering to the scanout until the next block handler.

I don't understand here. Would you please explain more detail? Thanks.

Quoted 2 lines

In general, try to keep the #ifdef out of the body of the code. In this

case,

Quoted 2 lines

and others, make intel_glamor_block_handler() be a no-op if GLAMOR is not enabled.

Agreed, will fix it next version.

Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

#4 lore raw

Re: [PATCH 2/3] glamor: turn on glamor.

Quoted 22 lines · Zhigang Gong
Quoted 12 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 5:12 PM
To: Zhigang Gong; [email protected]
Subject: Re: [Intel-gfx] [PATCH 2/3] glamor: turn on glamor.

Review void

Quoted 1 line · Zhigang Gong
(quoted diff) +0 -0
@@ -965,6 +969,9 @@ void

intel_uxa_block_handler(intel_screen_private *intel)

Quoted 10 lines

src/intel_uxa.c void intel_uxa_block_handler(intel_screen_private *intel) · line 975

Quoted 7 lines
src/intel_uxa.c +3 -0
 	 * framebuffer until significantly later.
 	 */
 	intel_flush_rendering(intel);
+#ifdef GLAMOR
+	intel_glamor_block_handler(intel);
+#endif
 }

I suspect this is the wrong way around as we are not flushing the render cache of glamor's rendering to the scanout until the next block handler.

Quoted 1 line

I don't understand here. Would you please explain more detail? Thanks.

Whenever we render, the data ends up in the Render Cache and needs to be flushed out to memory before it is coherent with the CPU or in this case the Display Engine (i.e. scanout).

intel_flush_rendering() does two tasks. The first is to submit any pending batch, and the second is to flush the Render Cache so that the modifications land on the scanout in a timely manner. It is probably best if those two tasks were separated so that we do:

intel_uxa_block_handler(intel); // flush the UXA batch intel_glamor_block_handler(intel); // flush the GL batch intel_flush_rendering(intel); // flush the RenderCache to scanout

However, you can simply rearrange the code and achieve it with the existing functions:

intel_glamor_block_handler(intel); // mark the front bo as dirty as needbe intel_flush_rendering(intel); // flush UXA batch along with RenderCache

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#5 lore raw

Re: [PATCH 2/3] glamor: turn on glamor.

Quoted 35 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 9:13 PM
To: Zhigang Gong; [email protected]
Subject: RE: [Intel-gfx] [PATCH 2/3] glamor: turn on glamor.

Quoted 12 lines · Zhigang Gong
Quoted 12 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 5:12 PM
To: Zhigang Gong; [email protected]
Subject: Re: [Intel-gfx] [PATCH 2/3] glamor: turn on glamor.

Review void

Quoted 1 line · Zhigang Gong
(quoted diff) +0 -0
@@ -965,6 +969,9 @@ void

intel_uxa_block_handler(intel_screen_private *intel)

Quoted 10 lines
Quoted 10 lines

src/intel_uxa.c void intel_uxa_block_handler(intel_screen_private *intel) · line 975

Quoted 7 lines
src/intel_uxa.c +3 -0
 	 * framebuffer until significantly later.
 	 */
 	intel_flush_rendering(intel);
+#ifdef GLAMOR
+	intel_glamor_block_handler(intel);
+#endif
 }

I suspect this is the wrong way around as we are not flushing the render cache of glamor's rendering to the scanout until the next block

handler.

Quoted 1 line

I don't understand here. Would you please explain more detail? Thanks.

Quoted 7 lines

Whenever we render, the data ends up in the Render Cache and needs to be flushed out to memory before it is coherent with the CPU or in this case the Display Engine (i.e. scanout).

intel_flush_rendering() does two tasks. The first is to submit any pending batch, and the second is to flush the Render Cache so that the modifications land on the scanout in a timely manner. It is probably best

if

Quoted 6 lines

those two tasks were separated so that we do:

intel_uxa_block_handler(intel); // flush the UXA batch intel_glamor_block_handler(intel); // flush the GL batch intel_flush_rendering(intel); // flush the RenderCache to scanout

Quoted 6 lines

However, you can simply rearrange the code and achieve it with the existing functions:

intel_glamor_block_handler(intel); // mark the front bo as dirty as
needbe
intel_flush_rendering(intel); // flush UXA batch along with RenderCache

Thanks for the explanation here. But I still don't think the original code is wrong
regard to this cache flushing issue. Here is my analysis:
intel_glamor_block_handler calls to glFlush(), and glFlush is similar with the
intel_flush_rendering, it calls intel_flush to flush the batch buffers and then
call intel_flush_frontbuffer to flush the frontbuffer which flushes the scan out
buffer. So when the screen pixmap is accessed by glamor, and after we call intel_glamor_block_handler, the Display Engine should see the correct data

Right?

- Zhigang

Quoted 5 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

#6 lore raw

Re: [PATCH 2/3] glamor: turn on glamor.

Quoted 67 lines · Zhigang Gong
Quoted 35 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 9:13 PM
To: Zhigang Gong; [email protected]
Subject: RE: [Intel-gfx] [PATCH 2/3] glamor: turn on glamor.

Quoted 12 lines · Zhigang Gong
Quoted 12 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 5:12 PM
To: Zhigang Gong; [email protected]
Subject: Re: [Intel-gfx] [PATCH 2/3] glamor: turn on glamor.

Review void

Quoted 1 line · Zhigang Gong
(quoted diff) +0 -0
@@ -965,6 +969,9 @@ void

intel_uxa_block_handler(intel_screen_private *intel)

Quoted 10 lines
Quoted 10 lines

src/intel_uxa.c void intel_uxa_block_handler(intel_screen_private *intel) · line 975

Quoted 7 lines
src/intel_uxa.c +3 -0
 	 * framebuffer until significantly later.
 	 */
 	intel_flush_rendering(intel);
+#ifdef GLAMOR
+	intel_glamor_block_handler(intel);
+#endif
 }

I suspect this is the wrong way around as we are not flushing the render cache of glamor's rendering to the scanout until the next block

handler.

Quoted 1 line

I don't understand here. Would you please explain more detail? Thanks.

Quoted 7 lines

Whenever we render, the data ends up in the Render Cache and needs to be flushed out to memory before it is coherent with the CPU or in this case the Display Engine (i.e. scanout).

intel_flush_rendering() does two tasks. The first is to submit any pending batch, and the second is to flush the Render Cache so that the modifications land on the scanout in a timely manner. It is probably best

if

Quoted 6 lines

those two tasks were separated so that we do:

intel_uxa_block_handler(intel); // flush the UXA batch intel_glamor_block_handler(intel); // flush the GL batch intel_flush_rendering(intel); // flush the RenderCache to scanout

Quoted 6 lines

However, you can simply rearrange the code and achieve it with the existing functions:

intel_glamor_block_handler(intel); // mark the front bo as dirty as
needbe
intel_flush_rendering(intel); // flush UXA batch along with RenderCache

Thanks for the explanation here. But I still don't think the original code is wrong
regard to this cache flushing issue. Here is my analysis:
intel_glamor_block_handler calls to glFlush(), and glFlush is similar with the
intel_flush_rendering, it calls intel_flush to flush the batch buffers and then
call intel_flush_frontbuffer to flush the frontbuffer which flushes the scan out
buffer. So when the screen pixmap is accessed by glamor, and after we call intel_glamor_block_handler, the Display Engine should see the correct data

Quoted 1 line

Right?

No.

glFlush() does call intel_flush_front(). However that in turn calls dri2->flushFrontBuffer which is implemented for EGL with

static void
dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate) {
/* FIXME: Does EGL support front buffer rendering at all? */
}

Neither does it perform the intended action via GLX (except that flushing the scanout is handled by the DDX as a normal part of its operation).
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#7 lore raw

Re: [PATCH 2/3] glamor: turn on glamor.

Quoted 86 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Monday, November 14, 2011 5:07 PM
To: Zhigang Gong; [email protected]
Subject: RE: [Intel-gfx] [PATCH 2/3] glamor: turn on glamor.

Quoted 33 lines · Zhigang Gong
Quoted 33 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 9:13 PM
To: Zhigang Gong; [email protected]
Subject: RE: [Intel-gfx] [PATCH 2/3] glamor: turn on glamor.

Quoted 23 lines · Zhigang Gong
Quoted 23 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 5:12 PM
To: Zhigang Gong; [email protected]
Subject: Re: [Intel-gfx] [PATCH 2/3] glamor: turn on glamor.

Review void

Quoted 1 line · Zhigang Gong
(quoted diff) +0 -0
@@ -965,6 +969,9 @@ void

intel_uxa_block_handler(intel_screen_private *intel)

src/intel_uxa.c void intel_uxa_block_handler(intel_screen_private *intel) · line 975

Quoted 7 lines
src/intel_uxa.c +3 -0
 	 * framebuffer until significantly later.
 	 */
 	intel_flush_rendering(intel);
+#ifdef GLAMOR
+	intel_glamor_block_handler(intel);
+#endif
 }

I suspect this is the wrong way around as we are not flushing the render cache of glamor's rendering to the scanout until the next block

Quoted 2 lines
Quoted 2 lines

handler.

Quoted 1 line

I don't understand here. Would you please explain more detail?

Thanks.

Quoted 2 lines
Quoted 2 lines

Whenever we render, the data ends up in the Render Cache and

needs

Quoted 32 lines
Quoted 7 lines

to be flushed out to memory before it is coherent with the CPU or in this case the Display Engine (i.e. scanout).

intel_flush_rendering() does two tasks. The first is to submit any pending batch, and the second is to flush the Render Cache so that the modifications land on the scanout in a timely manner. It is probably best

if

Quoted 6 lines

those two tasks were separated so that we do:

intel_uxa_block_handler(intel); // flush the UXA batch intel_glamor_block_handler(intel); // flush the GL batch intel_flush_rendering(intel); // flush the RenderCache to scanout

Quoted 7 lines

However, you can simply rearrange the code and achieve it with the existing functions:

intel_glamor_block_handler(intel); // mark the front bo as dirty
as needbe
intel_flush_rendering(intel); // flush UXA batch along with
RenderCache

Thanks for the explanation here. But I still don't think the original code is wrong regard to this cache flushing issue. Here is my analysis:
intel_glamor_block_handler calls to glFlush(), and glFlush is similar with the intel_flush_rendering, it calls intel_flush to flush the batch buffers and then call intel_flush_frontbuffer to flush the frontbuffer which flushes the scan out buffer. So when the screen pixmap is accessed by glamor, and after we call intel_glamor_block_handler, the Display Engine should see the correct data

Quoted 1 line

Right?

No.

glFlush() does call intel_flush_front(). However that in turn calls dri2->flushFrontBuffer which is implemented for EGL with

Quoted 7 lines

static void dri2_flush_front_buffer(__DRIdrawable * driDrawable, void

*loaderPrivate) {
   /* FIXME: Does EGL support front buffer rendering at all? */ }

Neither does it perform the intended action via GLX (except that flushing the scanout is handled by the DDX as a normal part of its operation).

You are right. EGL layer will not do a really front buffer flushing. We have to
let it be done in DDX layer. In my version 2 patch set, I already rearrange the
code sequence as you suggested please review it again. The remaining work for this issue is that I need to add new code to set the needs_flush according
to the access type of glamor. Will do that soon.

Thanks.

Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

#8 lore raw

Re: [PATCH 2/3] glamor: turn on glamor.

In reply to Zhigang Gong

src/intel_driver.c static void I830FreeScreen(int scrnIndex, int flags) · line 1132

Quoted 8 lines · Zhigang Gong
src/intel_driver.c +2 -1
@@ -1109,7 +1127,8 @@ static void I830FreeScreen(int scrnIndex, int flags)
 {
       ScrnInfoPtr scrn = xf86Screens[scrnIndex];
       intel_screen_private *intel = intel_get_screen_private(scrn);
-
+#ifdef GLAMOR
+#endif
 

Empty #ifdef block?

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [PATCH 2/3] glamor: turn on glamor.

Thanks for the review. Fixed that empty #ifdef block, missed one line code there to free glamor screen.

From: [email protected] [mailto:[email protected]] On Behalf Of Eugeni Dodonov
Sent: Friday, November 11, 2011 8:59 PM
To: Zhigang Gong
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH 2/3] glamor: turn on glamor.

On Fri, Nov 11, 2011 at 06:31, Zhigang Gong <[email protected]> wrote:

@@ -1109,7 +1127,8 @@ static void I830FreeScreen(int scrnIndex, int flags)

 {
       ScrnInfoPtr scrn = xf86Screens[scrnIndex];
       intel_screen_private *intel = intel_get_screen_private(scrn);

-
+#ifdef GLAMOR
+#endif

Empty #ifdef block?

Signature · 1 line
Eugeni Dodonov <http://eugeni.dodonov.net/> 

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

PATCH 3/3 glamor: Route fillspans and polyfillrects to glamor.

In reply to Zhigang Gong

If GLAMOR is enabled, we route UXA's fillspans and polyfillrects to glamor by default. And if glamor fail to accelerate it, UXA continue to handle it.

---
 uxa/uxa-accel.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
uxa/uxa-accel.c +12 -1
index 516834f..18fa63b 100644
@@ -27,7 +27,6 @@
  *    Michel Dänzer <[email protected]>
  *
  */
-
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
 #endif
@@ -37,6 +36,10 @@
 #include "uxa.h"
 #include "mipict.h"
 
+#ifdef GLAMOR
+#include "glamor.h"
+#endif
+
 static void
 uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
 	       DDXPointPtr ppt, int *pwidth, int fSorted)
@@ -49,6 +52,10 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
 	int nbox;
 	int x1, x2, y;
 	int off_x, off_y;
+#ifdef GLAMOR
+	if (glamor_fill_spans_nf(pDrawable, pGC, n, ppt, pwidth, fSorted))
+		return;
+#endif
 
 	if (uxa_screen->swappedOut || uxa_screen->force_fallback)
 		goto fallback;
@@ -673,6 +680,10 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
 	int n;
 	RegionPtr pReg = RECTS_TO_REGION(pScreen, nrect, prect, CT_UNSORTED);
 
+#ifdef GLAMOR
+	if (glamor_poly_fill_rect_nf(pDrawable, pGC, nrect, prect))
+		return;
+#endif
 	/* Compute intersection of rects and clip region */
 	REGION_TRANSLATE(pScreen, pReg, pDrawable->x, pDrawable->y);
 	REGION_INTERSECT(pScreen, pReg, pClip, pReg);
Signature · 6 lines
1.7.4.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

Re: [PATCH 3/3] glamor: Route fillspans and polyfillrects to glamor.

Quoted 3 lines · Zhigang Gong

If GLAMOR is enabled, we route UXA's fillspans and polyfillrects to glamor by default. And if glamor fail to accelerate it, UXA continue to handle it.

How is serialisation handled between the UXA and glamor acceleration routines? Don't you need to flush the UXA batch (if the pixmap is active) before handing over to glamor and similarly flush the glamor pixmap after failure?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#12 lore raw

Re: [PATCH 3/3] glamor: Route fillspans and polyfillrects to glamor.

Quoted 5 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 5:08 PM
To: Zhigang Gong; [email protected]
Subject: Re: [Intel-gfx] [PATCH 3/3] glamor: Route fillspans and

polyfillrects

Quoted 4 lines

to glamor.

On Fri, 11 Nov 2011 16:31:21 +0800, Zhigang Gong
<[email protected]> wrote:

Quoted 8 lines
Quoted 3 lines

If GLAMOR is enabled, we route UXA's fillspans and polyfillrects to glamor by default. And if glamor fail to accelerate it, UXA continue to handle it.

How is serialisation handled between the UXA and glamor acceleration routines? Don't you need to flush the UXA batch (if the pixmap is active) before handing over to glamor and similarly flush the glamor pixmap after failure?

Thanks for pointing this issue out. This is something I want to be discussed here.

There are three types of access to the pixmap:
1. UXA batch command buffer.
2. Glamor through OpenGL
3. CPU access mapped BO buffer.

My understanding is that the leading two types has the queue mechanism and need
to be handled carefully. In general, we can treat glamor 's access as another batch
buffer. Then in the place where current intel driver need to flush UXA batch buffer,
we also need to flush the GL operations there. Right?

And besides above places we need to flush glamor, we also need to flush UXA batch
buffer before call into glamor and also need to flush glamor after the glamor rendering
function really touch the pixmap.

Any comments?

Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

#13 lore raw

Re: [PATCH 3/3] glamor: Route fillspans and polyfillrects to glamor.

Quoted 34 lines · Zhigang Gong
Quoted 5 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 5:08 PM
To: Zhigang Gong; [email protected]
Subject: Re: [Intel-gfx] [PATCH 3/3] glamor: Route fillspans and

polyfillrects

Quoted 4 lines

to glamor.

On Fri, 11 Nov 2011 16:31:21 +0800, Zhigang Gong
<[email protected]> wrote:

Quoted 8 lines
Quoted 3 lines

If GLAMOR is enabled, we route UXA's fillspans and polyfillrects to glamor by default. And if glamor fail to accelerate it, UXA continue to handle it.

How is serialisation handled between the UXA and glamor acceleration routines? Don't you need to flush the UXA batch (if the pixmap is active) before handing over to glamor and similarly flush the glamor pixmap after failure?

Thanks for pointing this issue out. This is something I want to be discussed here.

There are three types of access to the pixmap:
1. UXA batch command buffer.
2. Glamor through OpenGL
3. CPU access mapped BO buffer.

My understanding is that the leading two types has the queue mechanism and need
to be handled carefully. In general, we can treat glamor 's access as another batch
buffer. Then in the place where current intel driver need to flush UXA batch buffer,
we also need to flush the GL operations there. Right?

Quoted 5 lines

And besides above places we need to flush glamor, we also need to flush UXA batch
buffer before call into glamor and also need to flush glamor after the glamor rendering
function really touch the pixmap.

Right, we want to consider it as another form of pixmap migration, just instead of between different regions of memory we are migrating between different queues. We could envision using fences to coordinate rendering between the different batches, but that is likely to be overkill and not possible with most Intel hardware.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#14 lore raw

Re: [PATCH 3/3] glamor: Route fillspans and polyfillrects to glamor.

Quoted 5 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 9:55 PM
To: Zhigang Gong; [email protected]
Subject: RE: [Intel-gfx] [PATCH 3/3] glamor: Route fillspans and

polyfillrects

Quoted 41 lines

to glamor.

Quoted 21 lines · Zhigang Gong
Quoted 5 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 11, 2011 5:08 PM
To: Zhigang Gong; [email protected]
Subject: Re: [Intel-gfx] [PATCH 3/3] glamor: Route fillspans and

polyfillrects

Quoted 4 lines

to glamor.

On Fri, 11 Nov 2011 16:31:21 +0800, Zhigang Gong
<[email protected]> wrote:

Quoted 8 lines
Quoted 3 lines

If GLAMOR is enabled, we route UXA's fillspans and polyfillrects to glamor by default. And if glamor fail to accelerate it, UXA continue to handle it.

How is serialisation handled between the UXA and glamor acceleration routines? Don't you need to flush the UXA batch (if the pixmap is active) before handing over to glamor and similarly flush the glamor pixmap after failure?

Thanks for pointing this issue out. This is something I want to be discussed here.

Quoted 6 lines

There are three types of access to the pixmap:
1. UXA batch command buffer.
2. Glamor through OpenGL
3. CPU access mapped BO buffer.

My understanding is that the leading two types has the queue

mechanism

Quoted 8 lines

and need to be handled carefully. In general, we can treat glamor 's access as another batch buffer. Then in the place where current intel driver need to flush UXA batch buffer, we also need to flush the GL operations there. Right?

And besides above places we need to flush glamor, we also need to flush UXA batch buffer before call into glamor and also need to flush glamor after the glamor rendering function really touch the pixmap.

Quoted 5 lines

Right, we want to consider it as another form of pixmap migration, just instead of between different regions of memory we are migrating between different queues. We could envision using fences to coordinate rendering between the different batches, but that is likely to be overkill and not possible with most Intel hardware.

Understand, so we can't expect to solve this overhead problem that way. IMO, as eventually, glamor will take over all the rendering functions, if glamor is enabled. This heavy flushing may be get eliminated then.

Anyway, currently, I still need to work out another patch to handle all the needed flushing OPs. Will submit it to review soon.

- Zhigang

Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

Reviewed-by on v1 1/3
#15 lore raw
In reply to Zhigang Gong
Quoted 7 lines · Zhigang Gong

Added one configuration option --enable-glamor to control whether use glamor. Added one new file intel_glamor.c to wrap glamor egl API for intel driver's usage.
This commit doesn't really change the driver's control path. It just adds necessary files for glamor and change some configuration.

For the series, I've reviewed the patches and they seem OK for me. I also like the idea of having Glamor available in main ddx branch, for easier testing.

So:

(However, I think Chris will have more comments, he is The Master of the DDX).

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx